package main

import "fmt"

func main() {
	sourceMap := make(map[string]int, 8)
	sourceMap["f"] = 1
	sourceMap["b"] = 2

	fmt.Println(sourceMap)

	fmt.Println(sourceMap["f"])

	// select
	var x, y, z chan int
	var a, b int

	select {
	case a = <-x:
		fmt.Println("received", a, "from x")
	case y <- b:
		fmt.Println("send", b, "to y")
	case f, ok := <-z:
		if ok {
			fmt.Println("receive", f, "from z")
		} else {
			fmt.Println("z is close")
		}
	default:
		fmt.Println("default")

	}

}
